use strict;
use warnings;

use Test::More tests => 6;

use HTML::FormFu;

my $form = HTML::FormFu->new->load_config_file('t/element_repeatable_inc.yml');

# submitting a count should automatically call:
# $form->count(1);
# $form->repeat;

$form->process({
    count => 1,
    foo0  => 'foo',
    foo1  => 'bar',
});

my $foo0 = $form->get_fields('foo0');
is( scalar @$foo0, 1 );

my $foo1 = $form->get_fields('foo1');
is( scalar @$foo1, 1 );

is( $form->params->{foo0}, 'foo' );
is( $form->params->{foo1}, 'bar' );

is( $form->render->field('foo0')->{value}, 'foo' );
is( $form->render->field('foo1')->{value}, 'bar' );
